
<template>
  <el-container>
    <el-header style="padding-top: 20px;">
      <el-form :inline="true" :model="params" class="demo-form-inline">
        <el-form-item label="KPI年份">
            <el-date-picker
              v-model="params.year"
              type="year"
              format="yyyy 年"
              value-format="yyyy"
              placeholder="选择年">
            </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">查询</el-button>
        </el-form-item>
    </el-form>
    </el-header>
    <el-main>
      <iframe :src='params.src' id='show' width='100%' height="780px" frameborder=0 name='showHere' ></iframe>
    </el-main>
  </el-container>
  
</template>

<script>
import Vue from 'vue'
import * as reportApi from '@/api/report/index';
export default {
  data() {
      return {
        params: { 
          year: '',
          src: ''
        }
      }
    },
    methods: {
      onSubmit() {
        const year = this.params.year
        if (year.length > 0)  {
          reportApi
          .getKPIByYear({
            year: year
          })
          .then(res => {
            console.log(res)
            if(res.code === 200) { this.params.src = res.data}
          });
        }
        
      }
    }
}
</script>



